package com.tbit.uqbike.webmanager.business.photo_upload_log.object.vo;

import com.tbit.uqbike.annos.Excel;
import com.tbit.uqbike.webmanager.business.photo_upload_log.object.PhotoUploadLog;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * 拍照还车日志vo
 *
 * @author <a href="mailto:zheng.zebiao@tbit.com.cn">zb</a>
 * @since 2024/9/19
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class PhotoUploadLogVo {
    /**
     * 主键
     */
    private Integer logId;
    /**
     * 区域代理商id
     */
    private Integer accountId;
    /**
     * 区域名称
     */
    @Excel(name = "运营区域", sort = 1)
    private String accountName;
    /**
     * 用户id
     */
    private Integer userId;
    /**
     * 用户手机号
     */
    @Excel(name = "用户手机号", sort = 4)
    private String phone;
    /**
     * 站点id
     */
    private Integer parkPointId;
    /**
     * 还车类型 1-拍照还车 2-拍二维码还车
     */
    @Excel(name = "还车类型", sort = 7, readConverterExp = "1=拍照还车,2=拍二维码还车")
    private Integer returnType;
    /**
     * 1成功、0失败
     */
    @Excel(name = "还车结果", sort = 8, readConverterExp = "1=成功,0=失败")
    private Integer result;
    /**
     * 车辆编号
     */
    @Excel(name = "车辆编号", sort = 5)
    private String userCode;
    /**
     * 订单编号
     */
    @Excel(name = "订单编号", sort = 3)
    private String orderNO;
    /**
     * 图片地址
     */
    @Excel(name = "照片信息", sort = 9)
    private String imageUrl;
    /**
     * 添加时间
     */
    @Excel(name = "申诉还车时间", sort = 6, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date addTime;
    /**
     * 订单时间
     */
    @Excel(name = "订单时间", sort = 2, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date orderTime;
    /**
     * 备注
     */
    @Excel(name = "结果备注", sort = 10)
    private String remark;

    public static PhotoUploadLogVo of(PhotoUploadLog log, String accountName, Date orderTime) {
        return new PhotoUploadLogVo()
                .setLogId(log.getLogId())
                .setAccountId(log.getAccountId())
                .setAccountName(accountName)
                .setUserId(log.getUserId())
                .setPhone(log.getPhone())
                .setParkPointId(log.getParkPointId())
                .setReturnType(log.getReturnType())
                .setResult(log.getResult())
                .setUserCode(log.getUserCode())
                .setOrderNO(log.getOrderNO())
                .setImageUrl(log.getImageUrl())
                .setAddTime(log.getAddTime())
                .setOrderTime(orderTime)
                .setRemark(log.getRemark());
    }
}
